package com.momo.mapper.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.momo.mapper.dataobject.OrderInfoDO;
import com.momo.mapper.mapper.OrderInfoDOMapper;

/**
* The Table ORDER_INFO.
* 注意:此结构有系统生成,禁止手工修改,以免被覆盖,请通过dalgen生成
* ORDER_INFO
*/
@Repository
public class OrderInfoDAO{

    @Autowired
    private OrderInfoDOMapper orderInfoDOMapper;

    /**
     * desc:插入表:ORDER_INFO.<br/>
     * descSql =  SELECT LAST_INSERT_ID() INSERT INTO ORDER_INFO( AMOUNT ,ITEM_ID ,USER_ID ,PROMO_ID ,ITEM_PRICE ,ORDER_PRICE )VALUES( #{amount,jdbcType=INTEGER} ,#{itemId,jdbcType=INTEGER} ,#{userId,jdbcType=INTEGER} ,#{promoId,jdbcType=INTEGER} ,#{itemPrice,jdbcType=DECIMAL} ,#{orderPrice,jdbcType=DECIMAL} )
     * @param entity entity
     * @return int
     */
    public int insert(OrderInfoDO entity){
        return orderInfoDOMapper.insert(entity);
    }
    /**
     * desc:更新表:ORDER_INFO.<br/>
     * descSql =  UPDATE ORDER_INFO SET AMOUNT = #{amount,jdbcType=INTEGER} ,ITEM_ID = #{itemId,jdbcType=INTEGER} ,USER_ID = #{userId,jdbcType=INTEGER} ,PROMO_ID = #{promoId,jdbcType=INTEGER} ,ITEM_PRICE = #{itemPrice,jdbcType=DECIMAL} ,ORDER_PRICE = #{orderPrice,jdbcType=DECIMAL} WHERE ID = #{id,jdbcType=VARCHAR}
     * @param entity entity
     * @return int
     */
    public int update(OrderInfoDO entity){
        return orderInfoDOMapper.update(entity);
    }
    /**
     * desc:根据主键删除数据:ORDER_INFO.<br/>
     * descSql =  DELETE FROM ORDER_INFO WHERE ID = #{id,jdbcType=VARCHAR}
     * @param id id
     * @return int
     */
    public int deleteById(String id){
        return orderInfoDOMapper.deleteById(id);
    }
    /**
     * desc:根据主键获取数据:ORDER_INFO.<br/>
     * descSql =  SELECT * FROM ORDER_INFO WHERE ID = #{id,jdbcType=VARCHAR}
     * @param id id
     * @return OrderInfoDO
     */
    public OrderInfoDO getById(String id){
        return orderInfoDOMapper.getById(id);
    }
}
